package Client_logic;

import java.awt.HeadlessException;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import GUI.CustomerForm;
import GUI.CustomerSearch;

/**
 * This class open windows for CustomerContactEmployee men
 * @author michael
 *
 */
public class CustomerContactEmployee {

	/**
	 * This method open AddCustomerForm
	 */
	public void addCustomer(){
		try{
			JFrame jframe = new JFrame();
			CustomerForm customerForm = new CustomerForm();
			customerForm.addSaveButton();
			jframe.setSize(400, 300);
			jframe.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
			jframe.setContentPane(customerForm);
			customerForm.getCancelButton().addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					;							
				}
			});
			jframe.setTitle("Add Customer");
			jframe.setVisible(true);
		}
		catch(HeadlessException headlessexception){
			JOptionPane.showMessageDialog(null, "FATAL ERROR");
		}	
	}	
	
	/**
	 * This method open UpdateCustomerForm
	 */
	public void UpdateCustomer()
	{
		try
		{
			CustomerSearch customersearch = new CustomerSearch("UpdateCustomer");
			customersearch.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE);
			customersearch.setSize( 400, 300 ); // set frame size
			customersearch.setVisible( true ); // display frame
		}catch(HeadlessException headlessexception)
		{
			JOptionPane.showMessageDialog(null, "FATAL ERROR","",JOptionPane.ERROR_MESSAGE);
		}	
	}
	
}
